home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr11
/
powerb5.zip
/
P5DOS002.TIP
< prev
next >
Wrap
Text File
|
1993-06-01
|
2KB
|
39 lines
In "50 Tips for DOS and Windows," Kay Nelson suggested
putting quotes around redirection symbols when using REM to
comment out lines in a batch file ("Help for Batch File
Fanatics," January 1992, page 209). I prefer to use a colon,
as in :REM, at the beginning of any comment line. This
causes DOS to think that the line is a label, and
redirection symbols on the line are therefore ignored. Also,
even if ECHO is on, DOS won't echo the line to the screen.
Chan Shippy
Colome, South Dakota
Editor's Note: For several reasons, I use colons instead of
REM when I place comments in my batch files. First, as Mr.
Shippy points out, there's no need to worry about DOS
reacting to redirection symbols on the line in unexpected
ways; second, the line is never echoed regardless of the
ECHO state. Finally, DOS skips over a line that starts with
a colon without trying to interpret it any further, and gets
right on with the work of handling the next line. This makes
the entire batch file run much faster, especially if you've
put in lots of comments.
I don't recommend using :REM as your standard way to set off
a comment, though. One day when you least expect it you may
have a reason to use the word REM as a label (it's a
perfectly legal label, as are all DOS batch commands). My
suggestion: Use a colon followed by an asterisk (:*)
instead. An asterisk isn't a legal label, and it draws
attention to the comment.
Title: Colons for Comments
Category: DOS
Issue Date: June, 1992
Editor: Brett Glass
Supplementary Files: None
Filename: P5DOS002.TIP